package network;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 邓大帅
 * Date: 2024-01-27
 * Time: 18:48
 */
public class UdpDictServer extends UdpEchoServer {
    private Map<String,String> map = new HashMap<>();
    public UdpDictServer(int port) throws SocketException {
        super(port);

        map.put("dog","狗");
        map.put("cat","mao");
        map.put("fuck","卧槽");
    }
    @Override
    public String process(String request) {
        return map.getOrDefault(request,"该单词未查到");
    }

    public static void main(String[] args) throws IOException {
        UdpDictServer udpDictServer = new UdpDictServer(9090);
        udpDictServer.start();
    }
}
